package net.neptech.controller;


import lombok.RequiredArgsConstructor;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/meeting")
@RequiredArgsConstructor
public class MeetingHistoryController {

    private final RedisTemplate<String, Object> redisTemplate;

    // 获取会议文件列表
    @GetMapping("/files/{conferenceId}")
    public ResponseEntity<List<String>> listFiles(@PathVariable String conferenceId) {
        String key = "meeting:files:" + conferenceId;
        List<Object> objs = redisTemplate.opsForList().range(key, 0, -1);
        List<String> files = objs != null ? objs.stream().map(Object::toString).toList() : List.of();
        return ResponseEntity.ok(files);
    }
}
